program Triangle;
const
  maxc = 60;
  max = 1000;
  mu10 : array[0..8] of longint =
  (1, 10, 100, 1000, 10000, 100000, 1000000, 10000000, 100000000);
  module = 1000000000;
type
  num = record
          l : integer;
          d : array[1..maxc] of longint;
        end;
var
  a : array[1..max] of num;
  n : integer;

procedure doc(k : integer);
var
  c : char;
  i, j, r, p, temp : longint;
  b : array[-1000..1000] of byte;
begin
  r := 0;
  fillchar(b, sizeof(b), 0);
  while not seekeoln do
  begin
    read(c);
    inc(r);
    b[r] := ord(c) - 48;
  end;
  readln;

  p := r;
  a[k].l := 0;
  for i := 1 to (r - 1) div 9 + 1 do
  begin
    temp := 0;
    for j := 0 to 8 do inc(temp, mu10[j]*b[p-j]);
    dec(p, 9);
    inc(a[k].l);
    a[k].d[a[k].l] := temp;
  end;
end;

procedure inp;
var
  i : integer;
begin
  readln(n);
  fillchar(a, sizeof(a), 0);
  for i := 1 to n do doc(i);
end;

procedure swap(i, j : longint);
var
  temp : num;
begin
  temp := a[i];
  a[i] := a[j];
  a[j] := temp;
end;

function nhohon(u, v : num) : boolean;
var
  i : integer;
begin
  if u.l < v.l then
  begin
    nhohon := true;
    exit;
  end;
  if v.l < u.l then
  begin
    nhohon := false;
    exit;
  end;
  for i := u.l downto 1 do
    if u.d[i] < v.d[i] then
    begin
      nhohon := true;
      exit;
    end else
    if u.d[i] > v.d[i] then
    begin
      nhohon := false;
      exit;
    end;
  nhohon := false;
end;

procedure sort(l, r : longint);
var
  i, j : longint;
  k : num;
begin
  if l >= r then exit;
  i := l;
  j := r;
  k := a[l + random(r-l+1)];
  repeat
    while nhohon(a[i], k) do inc(i);
    while nhohon(k, a[j]) do dec(j);
    if i <= j then
    begin
      swap(i, j);
      inc(i); dec(j);
    end;
  until i > j;
  sort(i, r); sort(l, j);
end;

procedure out(u : num);
var
  i : integer;
  so : string;
begin
  write(u.d[u.l]);
  for i := u.l-1 downto 1 do
  begin
    str(u.d[i], so);
    while length(so) < 9 do so := '0' + so;
    write(so);
  end;
end;

procedure plus(x, y : num;var z : num);
var
  i, c, nho : longint;
begin
  fillchar(z, sizeof(z), 0);
  if x.l > y.l then z.l := x.l
  else z.l := y.l;
  nho := 0;
  for i := 1 to z.l+1 do
  begin
    c := x.d[i] + y.d[i] + nho;
    nho := c div module;
    z.d[i] := c mod module;
  end;
  while (z.l > 1) and (z.d[z.l] = 0) do dec(z.l);
end;

procedure process;
var
  i : integer;
  sum : num;
begin
  sort(1, n);
  for i := 2 to n-1 do
  begin
    plus(a[i-1], a[i], sum);
    if nhohon(a[i+1], sum) then
    begin
      out(a[i-1]);
      write(' ');
      out(a[i]);
      write(' ');
      out(a[i+1]);
      exit;
    end;
  end;
  writeln(0, ' ', 0, ' ', 0);
end;

begin
  inp;
  process;
end.
